﻿<form role="form" id="comments-editor" name="addCommentForm" unsaved-warning-form>
    <div class="form-holder">
        <div ng-repeat="comment in comments track by comment.id" class="comment" ng-class="{isResolved : comment.isResolved}">
            <button type="button" class="btn btn-sm btn-link pull-right" ng-click="deleteComment(comment.id)" ng-i18next="Delete"></button>
            <button ng-hide="comment.isResolved" type="button" class="btn btn-sm btn-link pull-right" ng-click="resolveComment(comment)" ng-i18next="CommentEditorResolve"></button>
            <span class="author">{{comment.userEmail}}</span>
            <span class="date">{{comment.date}}</span>
            <p class="comment-text">{{comment.comment}}</p>
        </div>

        <div class="row" id="edit-entity-comment-row">
            <div class="form-group col-xs-12">
                <label class="wb-label" for="edit-entity-comment"> {{'EntityComment' | i18next}} <help key="newComment" /></label>
                <textarea name="comment" id="edit-entity-comment" ng-model="activeComment.comment" class="form-control" required msd-elastic></textarea>
                <div>
                    <span>{{activeComment.comment.length}} / {{maxCommentLength}}</span>
                </div>
                <div class="text-danger" ng-show="$scope.activeComment.serverValidation !== null">
                    <span>{{activeComment.serverValidation}}</span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <button type="submit" id="edit-post-comment-button" class="btn btn-lg " ng-class="{ 'btn-primary': addCommentForm.$dirty }" unsaved-warning-clear 
                    ng-click="postComment()" ng-if="!questionnaire.isReadOnlyForUser" ng-disabled="!addCommentForm.$valid" ng-i18next="EditorAddComment"></button>
        </div>
    </div>
</form>
